/*
 * @Author: gonglf
 * @Date: 2022-08-10 19:55:49
 * @LastEditors: gonglf
 * @LastEditTime: 2022-08-10 19:57:32
 * @Description:
 *
 */
package main

import (
	"fmt"
	"net"

	"gitee.com/network-learning/tcp/bag/proto"
)

func main() {
	conn, err := net.Dial("tcp", "127.0.0.1:30000")
	if err != nil {
		fmt.Println("dial failed, err", err)
		return
	}
	defer conn.Close()
	for i := 0; i < 20; i++ {
		msg := `Hello, Hello. How are you?`
		data, err := proto.Encode(msg)
		if err != nil {
			fmt.Println("encode msg failed, err:", err)
			return
		}
		conn.Write(data)
	}
}
